package ph.edu.upd.eee.upcatarchivesearch;

import android.util.Log;

/**
 * SearchResult.java
 *
 * A container class for a single entry in the archive. The entry contails
 * the SN, name, course, and campus of the exam taker.
 *
 * Created by smartwire on 10/3/2014.
 */
public class SearchResult implements Comparable <SearchResult> {
    private int relevance;
    private String SN, name, course, campus;

    public SearchResult() {
        // null :D
        this.SN = null;
        this.name = null;
        this.course = null;
        this.campus = null;
        this.relevance = 0;
    }

    public SearchResult(String CSVParsed[]) {
        super();

        this.SN = CSVParsed[0];
        this.name = CSVParsed[1];
        this.course = CSVParsed[2];
        this.campus = CSVParsed[3];
    }

    public SearchResult(String SN, String name, String course, String campus) {
        super();

        this.SN = SN;
        this.name = name;
        this.course = course;
        this.campus = campus;
    }

    public void printResult() {
        Log.d("app", "rank " + this.relevance + ": " + this.SN + " | " + this.name + " | " + this.course + " | " + this.campus);
    }

    public void upRelevance() {
        relevance++;
    }

    public String getSN() {
        return this.SN;
    }

    public String getName() {
        return this.name;
    }

    public String getCourse() {
        return this.course;
    }

    public String getCampus() {
        return this.campus;
    }

    public int getRelevance() {
        return this.relevance;
    }

    @Override
    public int compareTo(SearchResult b) {
        return this.relevance - b.relevance;
    }
}
